package com.ie.api.center.manager.feign;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ie.api.center.manager.hystrix.TenantClientHystrix;
import com.xj.common.bean.R;
import com.xj.common.bean.constant.Common;
import com.xj.common.dto.DeviceDto;
import com.xj.common.model.Device;
import com.xj.common.model.Tenant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;


//定义一个feign接口，通过@FeignClient("服务名")，来指定调用哪个服务
@FeignClient(value = Common.Service.IE_MANAGER_SERVICE_NAME,fallback= TenantClientHystrix.class)
public interface DeviceClient {

	/**
	 * 新增 Device
	 *
	 * @return R<Device>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_ADD, method = RequestMethod.POST)
	R<Device> add(@RequestBody JSONObject jsonParam);

	/**
	 * 根据 ID 删除 Device
	 *
	 * @return R<Boolean>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_DELETE, method = RequestMethod.POST)
	R<Boolean> delete(@RequestBody JSONObject jsonParam);

	/**
	 * 修改 Device
	 *
	 * @return R<Device>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_UPDATE, method = RequestMethod.POST)
	R<Device> update(@RequestBody JSONObject jsonParam);

	/**
	 * 根据 ID 查询 Device
	 *
	 * @return R<Device>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_SELECTBYID, method = RequestMethod.POST)
	R<Device> selectById(@RequestBody JSONObject jsonParam);

	/**
	 * 根据 驱动ID 查询 Device
	 *
	 * @return R<Device>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_SELECTBYDRIVERID, method = RequestMethod.POST)
	R<List<Device>> selectByDriverId(@RequestBody JSONObject jsonParam);

	/**
	 * 根据 模板ID 查询 Device
	 *
	 * @return R<Device>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_SELECTBYPROFILEID, method = RequestMethod.POST)
	R<List<Device>> selectByProfileId(@RequestBody JSONObject jsonParam);

	/**
	 * 分页查询 Device
	 *
	 * @return R<Page < Device>>
	 */
	@RequestMapping(value = Common.Service.IE_MANAGER_DEVICE+Common.Service.IE_MANAGER_DEVICE_LIST, method = RequestMethod.POST)
	R<Page<Device>> list(@RequestBody JSONObject jsonParam);

}






